Skip to content

refactor(hlo): make HloGenerator core API multiplatform#730

Merged
michalharakal merged 1 commit into
developfrom
codex/665-hlo-multiplatform
Jun 10, 2026
Merged

refactor(hlo): make HloGenerator core API multiplatform#730
michalharakal merged 1 commit into
developfrom
codex/665-hlo-multiplatform

Conversation

@michalharakal

Copy link
Copy Markdown
Contributor

Summary

Closes #665.

Moves the core HloGenerator.generate(model, sampleInput, functionName) workflow out of jvmMain and into commonMain, making StableHLO export available to all KMP targets (jvm, ios, linux, macos). The tracing → ComputeGraph → StableHLO MLIR pipeline has no JVM-specific dependencies, so it now lives in common code.

Changes

  • commonMain: HloGenerator.kt (core suspend generate(...) API) moved here from jvmMain.
  • jvmMain: new HloGeneratorJvm.kt keeps the JVM conveniences — generateBlocking(...) blocking wrapper (extension + JvmHloGenerator Java facade) and the internal ModelDescriptor overload used by the CLI. HloGeneratorMain.kt CLI unchanged.
  • commonTest: new HloGeneratorCommonTest.kt validates the platform-neutral export path (traces a square model, asserts emitted stablehlo.multiply + function/tensor types).
  • build.gradle.kts: skainet-lang-models promoted to commonMain; coroutines-test added to commonTest.
  • .api: regenerated for the relocated symbols.

Acceptance criteria (#665)

  • Core suspend HLO generation API available from commonMain
  • JVM CLI and blocking wrappers remain functional
  • No JVM-only dependencies leak into common code (all native/ios targets compile)
  • Existing regression tests continue passing
  • New common test validates the platform-neutral generator path

Verification

./gradlew :skainet-compile:skainet-compile-hlo:jvmTest :skainet-compile:skainet-compile-hlo:apiCheckBUILD SUCCESSFUL (compiles for jvm + iosArm64 + iosSimulatorArm64 + macosArm64 + linuxX64 + linuxArm64).

🤖 Generated with Claude Code

Move HloGenerator tracing and StableHLO conversion into commonMain, keep JVM blocking and descriptor helpers in jvmMain, and add common coverage for StableHLO generation.

Closes #665

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@michalharakal michalharakal merged commit 8e1a960 into develop Jun 10, 2026
4 checks passed
@michalharakal michalharakal deleted the codex/665-hlo-multiplatform branch June 10, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make HloGenerator core API multiplatform

1 participant